#include "GenericTypeArguments.h"
#include <cassert>
#include "DecoratedTypeDescription.h"
#include "TypeDescription.h"


uint64_t SGenericTypeArgumentGroup::GetHashCode() const
{   
    assert(Arguments.Num() > 0);

    uint64_t HashCode = 0;
    for (uint64_t i = 0; i < Arguments.Num(); ++i)
    {
        if(Arguments[i].BasicType)
        {
            HashCode=WH::HashCombine(HashCode, Arguments[i].BasicType->TypeID.GetHashCode());
        }
        else
        {
            // void type ,just add any number
            HashCode += 1;
        }
    }
    return HashCode;
}

bool SGenericTypeArgumentGroup::operator==(const SGenericTypeArgumentGroup& Other) const
{
    if (Arguments.Num() != Other.Arguments.Num())
    {
        return false;
    }

    for (uint64_t i = 0; i < Arguments.Num(); ++i)
    {
        if (!Arguments[i].IsSameWith(Other.Arguments[i]))
        {
            return false;
        }
    }

    return true;

}